package com.hu.boot.controller;

import com.hu.boot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Calendar;

@RestController
public class UserController {

    private final UserService userService;
    // 引入在 @Configuration 配置类中创建的对象
    private Calendar calendar;

    @Autowired
    public UserController(UserService userService, Calendar calendar) {
        this.userService = userService;
        this.calendar = calendar;
    }


    @RequestMapping("/hello")
    public String hello() {
        this.userService.test();
        System.out.println(this.calendar.getTime());
        return "hello world";
    }

}
